home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / test / output / test_MimeWriter < prev    next >
Text File  |  2005-10-18  |  2KB  |  111 lines

  1. test_MimeWriter
  2. From: bwarsaw@cnri.reston.va.us
  3. Date: Mon Feb 12 17:21:48 EST 1996
  4. To: kss-submit@cnri.reston.va.us
  5. MIME-Version: 1.0
  6. Content-Type: multipart/knowbot;
  7.     boundary="801spam999";
  8.     version="0.1"
  9.  
  10. This is a multi-part message in MIME format.
  11.  
  12. --801spam999
  13. Content-Type: multipart/knowbot-metadata;
  14.     boundary="802spam999"
  15.  
  16.  
  17. --802spam999
  18. Content-Type: message/rfc822
  19. KP-Metadata-Type: simple
  20. KP-Access: read-only
  21.  
  22. KPMD-Interpreter: python
  23. KPMD-Interpreter-Version: 1.3
  24. KPMD-Owner-Name: Barry Warsaw
  25. KPMD-Owner-Rendezvous: bwarsaw@cnri.reston.va.us
  26. KPMD-Home-KSS: kss.cnri.reston.va.us
  27. KPMD-Identifier: hdl://cnri.kss/my_first_knowbot
  28. KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996
  29.  
  30. --802spam999
  31. Content-Type: text/isl
  32. KP-Metadata-Type: complex
  33. KP-Metadata-Key: connection
  34. KP-Access: read-only
  35. KP-Connection-Description: Barry's Big Bass Business
  36. KP-Connection-Id: B4
  37. KP-Connection-Direction: client
  38.  
  39. INTERFACE Seller-1;
  40.  
  41. TYPE Seller = OBJECT
  42.     DOCUMENTATION "A simple Seller interface to test ILU"
  43.     METHODS
  44.             price():INTEGER,
  45.     END;
  46.  
  47. --802spam999
  48. Content-Type: message/external-body;
  49.     access-type="URL";
  50.     URL="hdl://cnri.kss/generic-knowbot"
  51.  
  52. Content-Type: text/isl
  53. KP-Metadata-Type: complex
  54. KP-Metadata-Key: generic-interface
  55. KP-Access: read-only
  56. KP-Connection-Description: Generic Interface for All Knowbots
  57. KP-Connection-Id: generic-kp
  58. KP-Connection-Direction: client
  59.  
  60.  
  61. --802spam999--
  62.  
  63. --801spam999
  64. Content-Type: multipart/knowbot-code;
  65.     boundary="803spam999"
  66.  
  67.  
  68. --803spam999
  69. Content-Type: text/plain
  70. KP-Module-Name: BuyerKP
  71.  
  72. class Buyer:
  73.     def __setup__(self, maxprice):
  74.         self._maxprice = maxprice
  75.  
  76.     def __main__(self, kos):
  77.         """Entry point upon arrival at a new KOS."""
  78.         broker = kos.broker()
  79.         # B4 == Barry's Big Bass Business :-)
  80.         seller = broker.lookup('Seller_1.Seller', 'B4')
  81.         if seller:
  82.             price = seller.price()
  83.             print 'Seller wants $', price, '... '
  84.             if price > self._maxprice:
  85.                 print 'too much!'
  86.             else:
  87.                 print "I'll take it!"
  88.         else:
  89.             print 'no seller found here'
  90.  
  91. --803spam999--
  92.  
  93. --801spam999
  94. Content-Type: multipart/knowbot-state;
  95.     boundary="804spam999"
  96. KP-Main-Module: main
  97.  
  98.  
  99. --804spam999
  100. Content-Type: text/plain
  101. KP-Module-Name: main
  102.  
  103. # instantiate a buyer instance and put it in a magic place for the KOS
  104. # to find.
  105. __kp__ = Buyer()
  106. __kp__.__setup__(500)
  107.  
  108. --804spam999--
  109.  
  110. --801spam999--
  111.